from django.contrib import admin
from admintest.contacts.models import *


class ContactInline(admin.TabularInline):
    model = Volunteer

class ContactAdmin(admin.ModelAdmin):
    pass
    #fields = ['first_name', 'last_name', 'address', 'suburb', 'state', 'country', 'email', 'date_added']
    fieldsets = [
            #(None,               {'fields': ['first_name', 'last_name']}),
            ('Name',               {'fields': ['first_name', 'last_name'], 'classes': ['extrapretty']}),
            ('Address Details', {'fields': ['address', 'suburb', 'state', 'postcode', 'country'], 'classes': ['expand']}),
            ('Contact Details', {'fields': ['email', ], 'classes': ['extrapretty', 'expand']}),
            ('Misc', {'fields': ['date_added', ], 'classes': ['expand']}),
    ]
    #inlines = [ContactInline]
    search_fields = ('postcode', 'first_name')

    list_display = ('first_name', 'last_name', 'suburb', 'email', 'id')
    list_filter = ('suburb', 'date_added', 'country', 'first_name')
admin.site.register(Contact, ContactAdmin)

class VolunteerAdmin(ContactAdmin):
    pass
admin.site.register(Volunteer, VolunteerAdmin)

class RecipientAdmin(ContactAdmin):
    list_filter = ('suburb', 'date_added', 'country', 'first_name')
    list_filter += ('has_attended_training', 'concession_checked_by', 'concession_type')
admin.site.register(Recipient, RecipientAdmin)
